-
-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cache the generated test main file: dub_test_root.d #2005
Conversation
Thanks for your pull request and interest in making D better, @foerdi! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. |
6f363e5
to
ce9c64c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- should come with a test (or at least unittests for newly added code)
source/dub/dub.d
Outdated
settings.platform.platform.join("."), | ||
settings.platform.architecture.join("."), | ||
settings.platform.compiler, settings.platform.frontendVersion, lbuildsettings.sourceFiles.length); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I'm aware the code is old, but I would still move this into a separate method. This way it will be easier to add unittests for it.
- Ideally you also move the bits to generate the package name from settings into a function instead of copying them around. This way it will be a lot easier in the future to find and adjust them
- I'm aware the code is old, but new additions should try to be better and have a few basic comments for future readers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mainfile = m_project.rootPackage.path ~ format(".dub/code/%s-%s-%s-%s-%s_%s_%s_dub_test_root.d", test_config, settings.buildType,
settings.platform.platform.join("."),
settings.platform.architecture.join("."),
settings.platform.compiler, settings.platform.frontendVersion, lbuildsettings.sourceFiles.length);
}
Be aware this is not the .dub/build
folder. In this place I cannot access the build_id
witch is generated in:
dub/source/dub/generators/build.d
Line 330 in 3288bbb
private string computeBuildID(string config, in BuildSettings buildsettings, GeneratorSettings settings) |
The buildsettings
can be changed in a project with dependencies.
Maybe someone has a better idea? I am aware this .dub/code
solution is not ideal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this place I cannot access the build_id witch is generated in:
What's stopping you from moving this out into a new public function:
string computeBuildName(string config, GeneratorSettings settings)
{
return format("%s-%s-%s-%s-%s_%s-%s", config, settings.buildType,
settings.platform.platform.join("."),
settings.platform.architecture.join("."),
settings.platform.compiler, settings.platform.frontendVersion, hashstr);
}
And calling this from both places?
Furthermore, you would want to hash lbuildsettings.sourceFiles
- not their length.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Furthermore, you would want to hash lbuildsettings.sourceFiles - not their length.
This is a good idea, thanks.
ce9c64c
to
2d839c2
Compare
2d839c2
to
b77edc0
Compare
source/dub/dub.d
Outdated
settings.platform.platform.join("."), | ||
settings.platform.architecture.join("."), | ||
settings.platform.compiler, settings.platform.frontendVersion, lbuildsettings.sourceFiles.length); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this place I cannot access the build_id witch is generated in:
What's stopping you from moving this out into a new public function:
string computeBuildName(string config, GeneratorSettings settings)
{
return format("%s-%s-%s-%s-%s_%s-%s", config, settings.buildType,
settings.platform.platform.join("."),
settings.platform.architecture.join("."),
settings.platform.compiler, settings.platform.frontendVersion, hashstr);
}
And calling this from both places?
Furthermore, you would want to hash lbuildsettings.sourceFiles
- not their length.
Should I click on |
Yes, please feel free to if it was a simple fix. Maybe be a bit more careful with a more in-depth discussion that wasn't fully resolved or might be relevant to other contributors so that they don't point out the same thing. |
b77edc0
to
f78acd9
Compare
Did you have a idea why the osx test runner are failing?
test/cache-generated-test-config.sh:8:
|
No, sorry but I recommend printing the output of stat on failure, s.t. you know what goes on. |
f743817
to
2b5a180
Compare
Now I have reduced and simplified my code. Theoretically, the time check of changed code files for the main file generator is not necessary due to the module name hashes. So I removed the time check. I noticed that a single macOS test run failed, but different from the last time, and it looks like this is not related to my changes (?). Can i do something about it? |
2b5a180
to
c86ae4a
Compare
these changes prevent dub from rebuilding a project every time it runs a unittest.
c86ae4a
to
b600afb
Compare
It would be nice if someone could take the time to review my MR. |
I need some more Information: Which package is failing to build or test? Maybe, can you check which files are in |
I didn't reduce the error yet, as there are other failures. Note that we're building with |
Sorry for my late reply, I forgot to reply about my hollidaies. If this is still a problem, it would be great if you could reduce this error a bit more then I could help you. I couldn't figure out which project couldn't be tested. |
@foerdi : It's the check step of |
@foerdi : I don't know exactly how to reproduce this, as it's only triggered during the package build process. |
@foerdi : I just reproduced this accidentally. Seems to trigger with $ DFLAGS='-wi' dub test -v
Using dub registry url 'https://code.dlang.org/'
Refreshing local packages (refresh existing: true)...
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /Users/geod24/.dub/packages/local-packages.json
Try to load local package map at /Users/geod24/.dub/packages/local-packages.json
Note: Failed to determine version of package custom-tool at .. Assuming ~master.
Looking for local package map at /Users/geod24/projects/geod24/bitblob/.dub/packages/local-packages.json
Determined package version using GIT: bitblob 1.1.4+commit.5.g73eaab4
Refreshing local packages (refresh existing: false)...
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /Users/geod24/.dub/packages/local-packages.json
Try to load local package map at /Users/geod24/.dub/packages/local-packages.json
Looking for local package map at /Users/geod24/projects/geod24/bitblob/.dub/packages/local-packages.json
Refreshing local packages (refresh existing: false)...
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /Users/geod24/.dub/packages/local-packages.json
Try to load local package map at /Users/geod24/.dub/packages/local-packages.json
Looking for local package map at /Users/geod24/projects/geod24/bitblob/.dub/packages/local-packages.json
Generating test runner configuration 'bitblob-test-library' for 'library' (library).
Get module name from path: /Users/geod24/projects/geod24/bitblob/source/geod24/bitblob.d
Refreshing local packages (refresh existing: false)...
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /Users/geod24/.dub/packages/local-packages.json
Try to load local package map at /Users/geod24/.dub/packages/local-packages.json
Looking for local package map at /Users/geod24/projects/geod24/bitblob/.dub/packages/local-packages.json
Configuring dependent bitblob, deps:
Performing "$DFLAGS" build using dmd for x86_64.
Target '/Users/geod24/projects/geod24/bitblob/.dub/build/bitblob-test-library-$DFLAGS-posix.osx.darwin-x86_64-dmd_v2.095.0-18ADA2291157B839D639A99D4340E461/bitblob-test-library' doesn't exist, need rebuild.
bitblob 1.1.4+commit.5.g73eaab4: building configuration "bitblob-test-library"...
dmd -c -of.dub/build/bitblob-test-library-$DFLAGS-posix.osx.darwin-x86_64-dmd_v2.095.0-18ADA2291157B839D639A99D4340E461/bitblob-test-library.o -wi -w -version=Have_bitblob -Isource/ .dub/code/bitblob-test-library--posix.osx.darwin-x86_64-dmd_v2.095.0-BB10D44F4B259993F6B84BBEB68A1E0C_dub_test_root.d source/geod24/bitblob.d -vcolumns
Error: module bitblob-test-library--posix.osx.darwin-x86_64-dmd_v2.095.0-BB10D44F4B259993F6B84BBEB68A1E0C_dub_test_root is in file '.dub/code/bitblob-test-library--posix.osx.darwin-x86_64-dmd_v2.095.0-BB10D44F4B259993F6B84BBEB68A1E0C_dub_test_root.d' which cannot be read
import path[0] = source/
import path[1] = /usr/local/opt/dmd/include/dlang/dmd
FAIL .dub/build/bitblob-test-library-$DFLAGS-posix.osx.darwin-x86_64-dmd_v2.095.0-18ADA2291157B839D639A99D4340E461/ bitblob-test-library executable
dmd failed with exit code 1.
$ ll .dub/code
total 8
-rw-r--r-- 1 geod24 staff 555 Feb 26 18:36 bitblob-test-library-$DFLAGS-posix.osx.darwin-x86_64-dmd_v2.095.0-BB10D44F4B259993F6B84BBEB68A1E0C_dub_test_root.d |
@Geod24 : Thank you, for your work and the reduced Test Case. Hopefully, I find some time this weekend to fix this bug. Now, how is the correct workflow? |
these changes prevent dub from rebuilding a project every time it runs a unittest.